package cn.com.project.pattern.q.chain;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

/**
 * @Desc 客户端
 * @Author wangjun
 * @Date 2018-02-27
 */
public class Client {

	public static void main(String[] args) {
		
		Random random = new Random();
		List<IStaff> staffList = new ArrayList<IStaff>();
		for (int i = 0; i < 15; i++) {
			staffList.add(new Staff(random.nextInt(3),"请假"));
		}
		
		Handler groupLeader = new GroupLeader();
		Handler departmentManager = new DepartmentManager();
		Handler generalManager = new GeneralManager();
		
		groupLeader.setNext(departmentManager);
		departmentManager.setNext(generalManager);
		
		for (IStaff staff : staffList) {
			groupLeader.handlerMessage(staff);
		}
	}
	
}
